//
// Created by Administrator on 2021/6/29.
//
//给定一个正整数，返回它在 Excel 表中相对应的列名称。

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

class Solution {
public:
    string convertToTitle(int columnNumber) {
        /**
         * 26进制
         */
        string ans;
        while (columnNumber > 0) {
            int a0 = (columnNumber - 1) % 26 + 1;
            ans += char(a0 - 1 + 'A');
            columnNumber = (columnNumber - a0) / 26;
        }
        reverse(ans.begin(), ans.end());
        return ans;
    }

    string convertToTitle2(int columnNumber) {
        string ans;
        while (columnNumber > 0) {
            --columnNumber;
            ans += char(columnNumber % 26 + 'A');
            columnNumber /= 26;
        }
        reverse(ans.begin(), ans.end());
        return ans;
    }

};

int main() {
    Solution sol;
    int target;
    while (cin >> target) {
        cout << "input a number: (quit if nan):" << endl;
        cout << sol.convertToTitle2(target) << endl;
    }
    return 0;
}